<meta charset="utf-8">
<title>null check</title>
<script>
function validate(){
	if(document.loginForm.id.value.length==0){
		alert('아이디를 입력하세요.');
		return false;
	}else{		
		return true;
	}
}
function validate2(){
	if(document.loginForm2.id.value==""){
		alert('아이디를 입력하세요.');
	}else{
		document.loginForm2.action="next.html";
		document.loginForm2.submit();
	}
}
</script>
<form name="loginForm" action="next.html" onSubmit="return validate()">
	<input type="text" name="id"/>
	<input type="submit"/>
</form>
<form name="loginForm2">
	<input type="text" name="id"/>
	<button onClick="validate2()">전송</button>
</form>